<?php
// +----------------------------------------------------------------------
// | JSHOP [ 小程序商城 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2018 http://jihainet.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: tianyu <tianyu@jihainet.com>
// +----------------------------------------------------------------------

namespace app\api\controller;

use app\common\controller\Api;
use app\common\model\Article as articleModel;
use app\common\model\ArticleType as articleTypeModel;

class Article extends Api
{


    /**
     *
     *  获取指定分类的文章列表
     *
     */
    public function articleList ()
    {
        $articleModel = new articleModel();
        return $articleModel->articleList(
            input('param.type_id/d'),
            input('param.codes/s'),
            json_decode(input('param.where'), true),
            input('param.order/s', 'ctime desc'),
            input('param.page/d', 1),
            input('param.limit/d', 10)
            );
    }



    /**
     *  获取文章详情
     *
     */
    public function articleDetail ()
    {
        $articleModel = new articleModel();
        return $articleModel->articleDetail(input('param.id/d'));
    }




    /**
     *
     *  设置文章阅读量
     *
     */
    public function setReadNum ()
    {
        $articleModel = new articleModel();
        return $articleModel->setArticleReadAmount(input('param.id/d'));
    }

}